<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Home</title>
    </head>
    <body>
        <?php
        require_once 'config.php';
        if(!isset($_COOKIE["username"])){
            header("Location:login.php");
        }
        echo'<a href="logout.php">logout</a><br/>';
        $username=$_COOKIE["username"];
        $rt=$_GET["rt"];?>
         <h2>Please Visit Your Repository</h2>
        <fieldset>
        <?php
        $url=$path.$username."/".$rt;
        echo "<legend><strong>directory : ".$url."</strong></legend>";
        $dir=opendir($url);
        
        $iter="";
        while (($file = readdir($dir)) !== false)
          {
            if($file!="." && $file!=".."){
                if(is_dir($url."/".$file)){
                    $iter=$rt."/".$file;
                    echo "<a href='direktorihandler.php?rt=".$iter."'>Direktori : ".$file."</a><br/>";
                }
                else{
                    echo "<a href='".$url."/".$file."' target='blank'>File : " . $file . "</a><br />";
                }
            }
          }
        closedir($dir);
        ?>
            </fieldset>
	<br /><hr size="1"><br />

  <div class="clear"></div>
    </body>
</html>
